package com.example.walletmodule.conrtoller;

import com.example.walletmodule.entity.UserEntity;
import com.example.walletmodule.service.UserService;
import com.example.walletmodule.util.CommonResult;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;


/**
 * 用户表-用户基本信息
 *
 * @author wangqiao
 * @date 2023-02-21 16:40:42
 */
@RestController
@RequestMapping("user")
public class UserController {
    @Resource
    private UserService userService;

    @GetMapping("/getuser")
    public CommonResult<UserEntity> getUser(@RequestBody UserEntity user){
        UserEntity user1 = userService.getById(user.getUserId());
        return CommonResult.success(user1, "成功获取");
    }
    @PostMapping("/adduser")
    public CommonResult<Integer> addUser(@RequestBody UserEntity user){
        Integer x = userService.addUser(user);
        return CommonResult.success(x, "成功创建新的用户");
    }
}
